﻿<%@ Page Language="C#" MasterPageFile="~/EasyUI.master" AutoEventWireup="true"
    CodeBehind="Add.aspx.cs" Inherits="jnxc.Web.product.Add" Title="增加页" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Script/upimg.js"></script>
    <script type="text/javascript">
        $(function () {
            InitTree();
            var img = $('#<%# hfimg.ClientID%>').val();
            if (img != "") {
                $('#preview').attr("src", img);
            }
        });
        function InitTree() {
            $('#tcontrol').tree({
                url: '../controlinfo/GetControl.ashx', //请求数据的页面               
                width: '100%', //宽度
                //height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
                lines: true,
                method: 'post',
                queryParams: { "action": "query" },
                checkbox: true,
                onlyLeafCheck: true,
                onCheck: function (node, checked) {
                    if (checked) {
                        var cknodes = $(this).tree("getChecked");
                        if (cknodes.length > 1) {
                            for (var i = 0 ; i < cknodes.length ; i++) {
                                $(this).tree("uncheck", cknodes[i].target);
                            }
                            //再选中改节点
                            $(this).tree("check", node.target);
                        }
                        $('#<%# hfcid.ClientID%>').val(node.id);  // 在用户点击的时候提示
                    }
                },
                onLoadSuccess: function (node, data) {
                    var cid = $('#<%# hfcid.ClientID%>').val();
                    if (cid != "") {
                        var node = $('#tcontrol').tree("find", cid);
                        $('#tcontrol').tree("check", node.target);
                    }
                }
            });
            }
            function testchk() {
                var hid = $('#<%# hfcid.ClientID%>').val();
                 if (hid != "") {
                     return true;

                 }
                 else {
                     $.messager.alert("提示", "请选择一个防治技术！", "info");
                     return false;
                 }

             }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="fm" method="post" runat="server">
        <table style="width: 100%;" cellpadding="2" cellspacing="1" class="border">
            <tr>
                <td class="tdbg">

                    <table cellspacing="0" cellpadding="0" width="100%" border="0">
                        <tr>
                            <td align="right" style="width: 200px;" rowspan="5">
                                <div id="dcontrol" class="easyui-panel" title="防治技术"
                                    style="width: 300px; padding: 10px; background: #fafafa;"
                                    data-options="iconCls:'icon-cut',closable:false">
                                    <ul id="tcontrol"></ul>
                                </div>
                            </td>
                            <td align="right">名称
	：</td>
                            <td width="*" align="left">
                                <asp:TextBox ID="txtpname" runat="server" Width="200px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">参数
	：</td>
                            <td width="*" align="left">
                                <CKEditor:CKEditorControl ID="ckpara" runat="server"></CKEditor:CKEditorControl>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="ckpara" ErrorMessage="RequiredFieldValidator"
                                    ForeColor="Red">内容不能为空</asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">简介
	：</td>
                            <td width="*" align="left">
                                <CKEditor:CKEditorControl ID="ckcontent" runat="server"></CKEditor:CKEditorControl>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="ckcontent" ErrorMessage="RequiredFieldValidator"
                                    ForeColor="Red">内容不能为空</asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">图片
	：</td>
                            <td height="25" width="*" align="left">
                                <asp:FileUpload ID="fuIndFile" runat="server" onchange="javascript:setImagePreview(this,localImag,preview);" />
                                <asp:HiddenField ID="hfimg" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">预览:</td>
                            <td height="25" width="*" align="left">
                                <div id="localImag" style="height: 80px">
                                    <img id="preview" alt="预览图片" onclick="over(preview,divImage,imgbig);" src="../teampics/user.jpg" style="width: 100px; height: 80px;" />
                                </div>
                            </td>
                        </tr>
                    </table>


                </td>
            </tr>
            <tr>
                <td class="tdbg" align="center" valign="bottom">
                    <asp:Button ID="btnSave" runat="server" Text="保存"
                        OnClick="btnSave_Click" OnClientClick="return testchk()"></asp:Button>
                    <asp:Button ID="btnCancle" runat="server" Text="取消"
                        OnClick="btnCancle_Click" class="inputbutton" onmouseover="this.className='inputbutton_hover'"
                        onmouseout="this.className='inputbutton'"></asp:Button>
                    <asp:HiddenField ID="hfcid" runat="server" />
                    <asp:HiddenField ID="hfpid" runat="server" />
                </td>
            </tr>
        </table>
    </form>
</asp:Content>
<%--<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceCheckright" runat="server">
</asp:Content>--%>
